package com.bcx.crm.spring_boot.conditional;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 * Created by ys on 2018/5/12.
 * 1.通过@Conditional注解,符合Windows条件则实例化windowsListService
 * 2.通过@Conditional注解,符合Linux条件则实例化linuxListService
 */
@Configuration
public class ConditionConfig {
    @Bean
    @Conditional(WindowsCondition.class)    //1.
    public ListService windowsListService(){
        return new WindowsListService();
    }
    @Bean
    @Conditional(LinuxCondition.class)  //2.
    public ListService linuxListService(){
        return new LinuxListService();
    }
}
